#include <iostream>
#include <functional>
#include <memory>
#include "TcpServer.hpp"
#include "Calculator.hpp"
using namespace std;

Calculator calculator;

void DefaultOnMessage(std::shared_ptr<Connection> connection_ptr)
{
    // 对报文进行处理，有bug
    std::cout << "上层得到了数据: " << connection_ptr->Inbuffer() << std::endl;
    std::string response_str = calculator.Handler(connection_ptr->Inbuffer());
    
    // response_str 发送出去
}
int main()
{
    std::shared_ptr<TcpServer> svr(new TcpServer(8888, DefaultOnMessage));
    svr->Init();
    svr->Loop();

    return 0;
}